Public Class BookInfoDesigner
    Inherits System.Web.UI.Design.ControlDesigner
    Private _Description As String

    Public Overrides Function GetDesignTimeHtml() As String
        Dim strDesignHTML As String

        Try
            strDesignHTML = MyBase.GetDesignTimeHtml
            Dim bi As BookData
            bi = CType(Me.Component, BookData)

            If bi.Description > "" Then
                _Description = bi.Description
            End If
            If _Description > "" Then
                strDesignHTML = "<b>Tag Content</b> <br/> " & _
                                "&lt;Description>" & _Description & " &lt;/Description>"
            End If

        Catch ex As Exception
            strDesignHTML = GetErrorDesignTimeHtml(ex)
        End Try

        If strDesignHTML Is Nothing Then
            strDesignHTML = GetEmptyDesignTimeHtml()
        ElseIf strDesignHTML.Length = 0 Then
            strDesignHTML = GetEmptyDesignTimeHtml()
        End If

        Return strDesignHTML

    End Function

    Protected Overrides Function GetEmptyDesignTimeHtml() As String
        Return Me.CreatePlaceHolderDesignTimeHtml("<B> No content to display </B>")
    End Function

    Protected Overrides Function GetErrorDesignTimeHtml(ByVal e As System.Exception) _
                                                                           As String
        Return Me.CreateErrorDesignTimeHtml(e.Message)
    End Function

    Public Overrides ReadOnly Property Verbs() As _
                System.ComponentModel.Design.DesignerVerbCollection
        Get
            Dim vrbs As New System.ComponentModel.Design.DesignerVerbCollection
            Dim vrb As New System.ComponentModel.Design.DesignerVerb("Set Description", _
                                                                  AddressOf GetDescription)
            vrbs.Add(vrb)
            Return vrbs
        End Get


    End Property

    Sub GetDescription(ByVal sender As Object, ByVal e As System.EventArgs)
        _Description = InputBox("Enter Description", "Description", _Description)

        Me.UpdateDesignTimeHtml()
    End Sub

    Public Overrides Function GetPersistenceContent() As String
        Return "<Description>" & _Description & "</Description>"
    End Function

End Class
